package test;

import java.util.Scanner;

public class Demo4 {

    public static void main(String[] args) {
        Scanner shuRut = new Scanner(System.in);

        while (shuRut.hasNext()) {

            String tarString = shuRut.nextLine();

            if (tarString.replaceAll("[a-z,A-Z]", "").length() > 0) {
                System.out.println(0);
                return;
            }

            String resStr = diGui(tarString);
            System.out.println(resStr.length());

        }
    }

    private static String diGui(String tarString) {

        if (tarString == null || tarString.length() == 0) {
            return "";
        }

        for (int i = 0; i < tarString.length(); i++) {
            String linShi = tarString.substring(i, i + 1) + tarString.substring(i, i + 1);
            if (tarString.contains(linShi)) {
                return diGui(tarString.replace(linShi, ""));
            }
        }

        return tarString;
    }
}
